import sys

def merge_1(arr, arr_1, left, right, mid):
    count = 0
    i = left # 左子数组起始位置
    j = mid + 1 # 右子数组起始位置
    k = left # 临时数组位置

    while i <= mid and j <= right:
        if arr[i] <= arr[j]:  # 左元素 <= 右元素，正常顺序，无逆序对
            arr_1[k] = arr[i]
            i += 1
        else: # 左元素 > 右元素 → 发现逆序对
            arr_1[k] = arr[j]
            count += (mid - i + 1) # 计算逆序对, 如果左子数组的某个元素大于右子数组的当前元素，那么左子数组中从这个位置到末尾的所有元素都大于右子数组的当前元素
            j += 1
        k += 1

    while i <= mid:
        arr_1[k] = arr[i]
        i += 1
        k += 1

    while j <= right:
        arr_1[k] = arr[j]
        j += 1
        k += 1

    for x in range(left, right + 1):
        arr[x] = arr_1[x]

    return count

def merge_2(arr, arr_1, left, right):
    count_1 = 0

    if left < right:
        mid = (left + right) // 2
        count_1 += merge_2(arr, arr_1, left, mid)
        count_1 += merge_2(arr, arr_1, mid + 1, right)
        count_1 += merge_1(arr, arr_1, left, right, mid)

    return count_1

def solve():
    line = sys.stdin.readline().strip()

    if not line: # 输入为空
        print(0)
        return

    nums = list(map(int, line.split()))
    n = len(nums)

    if n <= 1:
        print(0)
        return

    arr_1 = [0] * n # 临时数组
    res = merge_2(nums, arr_1, 0, n - 1)

    print(res)

solve()
"""
示例 1:
输入:
1 5 4 3 2 7
输出: 6
解释: 数组中的逆序对为: (5,4) (5,3) (5,2) (4,3) (4,2) (3,2)
示例 2:
输入:
-1 7 4
输出: 1
解释: 数组中的逆序对为: (7,4)
"""